﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Fantacid303.ProcessAffinityControl.Common;

namespace Fantacid303.ProcessAffinityControl.Config
{
	/// <summary>
	/// Represents the basic root configuration node.
	/// </summary>
	public class Configuration 
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="Configuration"/> class.
		/// </summary>
		public Configuration()
		{
			this.ConfigurationEntries = new List<ConfigurationEntry>();
			this.ProcessIgnoreList = new List<string>();
		}

		/// <summary>
		/// Gets or sets the interval in which the process list is scanned
		/// </summary>
		/// <value>The interval.</value>
        public uint Interval
		{ get; set; }

		/// <summary>
		/// Gets or sets the configuration entries.
		/// </summary>
		/// <value>The configuration entries.</value>
		public List<ConfigurationEntry> ConfigurationEntries
		{ get; set; }

		/// <summary>
		/// Gets or sets the process ignore list.
		/// </summary>
		/// <value>The process ignore list.</value>
		public List<string> ProcessIgnoreList
		{ get; set; }


		/// <summary>
		/// Gets the active entry.
		/// </summary>
		/// <value>The active entry.</value>
		[XmlIgnore]
		public ConfigurationEntry ActiveEntry
		{
			get
			{
				return this.ConfigurationEntries.FirstOrDefault(a=>a.IsActive);
			}
		}		
	}
}
